path = './test02.txt'
f_name = open(file=path, mode='w', buffering=1, encoding='utf-8')
count01 = f_name.write('我爱你中国')
print(f'{f_name.name}写入完成,写入了{count01}个字符')
f_name = open(file=path, mode='a', buffering=1, encoding='utf-8')
count02 = f_name.write('亲爱的母亲')
print(f'{f_name.name}内容追加完成,追加了{count02}个字符')
# 关闭文件
f_name.close()
